//
//	MVSinger.m
//
//	Create by mafeng on 13/8/2016
//	Copyright © 2016. All rights reserved.
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "MVSinger.h"

NSString *const kMVSingerIdField = @"id";
NSString *const kMVSingerMid = @"mid";
NSString *const kMVSingerName = @"name";

@interface MVSinger ()
@end
@implementation MVSinger




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kMVSingerIdField] isKindOfClass:[NSNull class]]){
		self.idField = dictionary[kMVSingerIdField];
	}

	if(![dictionary[kMVSingerMid] isKindOfClass:[NSNull class]]){
		self.mid = dictionary[kMVSingerMid];
	}	
	if(![dictionary[kMVSingerName] isKindOfClass:[NSNull class]]){
		self.name = dictionary[kMVSingerName];
	}	
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	dictionary[kMVSingerIdField] = self.idField;
	if(self.mid != nil){
		dictionary[kMVSingerMid] = self.mid;
	}
	if(self.name != nil){
		dictionary[kMVSingerName] = self.name;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	[aCoder encodeObject:self.idField forKey:kMVSingerIdField];	if(self.mid != nil){
		[aCoder encodeObject:self.mid forKey:kMVSingerMid];
	}
	if(self.name != nil){
		[aCoder encodeObject:self.name forKey:kMVSingerName];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.idField = [aDecoder decodeObjectForKey:kMVSingerIdField];
	self.mid = [aDecoder decodeObjectForKey:kMVSingerMid];
	self.name = [aDecoder decodeObjectForKey:kMVSingerName];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	MVSinger *copy = [MVSinger new];

	copy.idField = self.idField;
	copy.mid = [self.mid copyWithZone:zone];
	copy.name = [self.name copyWithZone:zone];

	return copy;
}
@end
